import request from '@/util/request'
import type { Code, LoginParam, TokenInfo } from '@/api/login/types'
import qs from 'qs'

const api:string = '/auth'

export const getCode = () => {
    return request<Code, Code>({
        url: api+'/code/getCode',
        method: 'get'
    })
}

export const login = (form: LoginParam) => {
    return request<TokenInfo, TokenInfo>({
        url: api+'/user/login',
        method: 'post',
        data: qs.stringify(form)
    })
}